package newsAction;

import PO.NewsInfoPO;
import newsDao.NewsDao;

public class updateNews {
	private int id;
	private String title;
	private String content;
	private String time;
	private String maker;

	private String message = "input";

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public String getTime() {
		return time;
	}

	public void setTime(String time) {
		this.time = time;
	}

	public String getMaker() {
		return maker;
	}

	public void setMaker(String maker) {
		this.maker = maker;
	}

	public String execute() throws Exception {
		NewsDao dao = new NewsDao();
		boolean update = dao.updateNews(info());
		if (update) {
			message = "success";
		}
		return message;
	}

	public NewsInfoPO info() {
		NewsInfoPO info = new NewsInfoPO();
		info.setId(this.getId());
		info.setTitle(this.getTitle());
		info.setContent(this.getContent());
		info.setTime(this.getTime());
		info.setMaker(this.getMaker());

		return info;
	}

}
